package top.xunfong.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum ProviderEnum {

    ALI_YUN("阿里云", "aliyun"),
    TENCENT("腾讯云", "tencent"),
    DEFAULT("未知服务商", "default"),
    ;


    private String name;
    private String code;

    public static ProviderEnum getByCode(String code) {
        for (ProviderEnum value : values()) {
            if (value.code.equals(code)) {
                return value;
            }
        }
        return DEFAULT;
    }
}
